package br.com.neb.caronamanager.model;

import java.text.SimpleDateFormat;
import java.util.Date;

public class Carona {

	private Integer id;
	private Integer date;
	private String driver;
	private int roundTrip;
	
	public Carona() {}
	public Carona(Integer date, String driver, int roundTrip) {
		super();
		this.date = date;
		this.driver = driver;
		this.roundTrip = roundTrip;
	}
	
	public Carona(Integer id, Integer date, String driver, int roundTrip) {
		super();
		this.id = id;
		this.date = date;
		this.driver = driver;
		this.roundTrip = roundTrip;
	}
	
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public Integer getDate() {
		return date;
	}
	public void setDate(Integer date) {
		this.date = date;
	}
	public String getDriver() {
		return driver;
	}
	public void setDriver(String driver) {
		this.driver = driver;
	}
	public int getRoundTrip() {
		return roundTrip;
	}
	public void setRoundTrip(int roundTrip) {
		this.roundTrip = roundTrip;
	}
	
	@Override
	public String toString() {
		final SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
		Long time = 0l;
		if(getDate()<0)
			time = (getDate()*-1)*1000l;
		else
			time = getDate()*1000l;
		
		Date date = new Date(time);
		return "Id: "+ getId() + "\nDate: " + sdf.format(date)+"\nDriver: " + getDriver() +"\nRoundTrip: " + (getRoundTrip()==1?"yes":"no");
	}
	
	
	
	
	
}
